package file;

import java.io.File;

public class FileDemo {
    public static void main(String[] args) {
//        File file = new File("E:/JAVA/JSD2208_SE"/demo.txt);
        //相对路径中的"./"表达当前项目目录
        //相对于IDEA中执行程序时，"./"表达的就是当前项目目录
        File file = new File("./demo.txt");
        String name = file.getName();
        System.out.println("名字:"+name);

        long length = file.length();//文件的字节数
        System.out.println("长度:"+length+"字节");
        //判断file表示的文件或目录是否可读或可写
        boolean cr = file.canRead();
        System.out.println(cr);
        boolean cw = file.canWrite();
        System.out.println(cw);
        //是否被隐藏
        boolean ih = file.isHidden();
        System.out.println("是否隐藏:"+ih);
    }
}
